let { getUsers, updateUsers, deleteUsers, addUsers,getUsersSubsidiary } = require('../dao/usersDao');
//查看我负责的所有客户
module.exports.getUsers = async function (result) {
    let data = await getUsers(result);
    if (data.length > 0) {
        return {
            code: 1,
            msg: '获取成功',
            data
        }
    }
    return {
        code: 0,
        msg: '获取失败',
    }
}
//修改客户信息
module.exports.updateUsers = async function (result) {
    let data = await updateUsers(result);
    if (data) {
        return {
            code: 1,
            msg: '修改成功',
            data
        }
    }
    return {
        code: 0,
        msg: '修改失败',
    }
}
//删除客户信息
module.exports.deleteUsers = async function (result) {
    let data = await deleteUsers(result);
    if (data) {
        return {
            code: 1,
            msg: '删除成功',
            data
        }
    }
    return {
        code: 0,
        msg: '删除失败',
    }
}
//新增客户
module.exports.addUsers = async function (result) {
    let data = await addUsers(result);
    if (data) {
        return {
            code: 1,
            msg: '新增成功',
            data
        }
    }
    return {
        code: 0,
        msg: '新增失败',
    }
}
//查看所属销售员
module.exports.getUsersSubsidiary = async function () {
    let data = await getUsersSubsidiary();
    if (data) {
        return {
            code: 1,
            msg: '获取成功了',
            data
        }
    }
    return {
        code: 0,
        msg: '获取失败',
    }
}